KDIR ?= /usr/src/linux-headers-`uname -r`

ARCH =
CC := ${CROSS_COMPILE}gcc
STRIP := ${CROSS_COMPILE}strip

# Always keep the dynamic debug facility enabled
ccflags-y   += -DDYNAMIC_DEBUG_MODULE

MYDEBUG := y
ifeq (${MYDEBUG}, y)
	ccflags-y   += -DDEBUG -g -O0 \
	  -ggdb -gdwarf-4 -Wall -fno-omit-frame-pointer -fvar-tracking-assignments
endif


obj-m += mydrv.o

.PHONY = all clean rebuild module app

all: module
	@#echo "--- Building: ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE}  ccflags-y=${ccflags-y} ---"

module:
	make -C $(KDIR) M=$(PWD) modules

clean:
	@#echo "--- Clean ---"
	make -C $(KDIR) M=$(PWD) clean
	rm -f *.mod


rebuild: clean all
